<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\CmsContent;
use common\models\BaseSite;

/* @var $this yii\web\View */
/* @var $model common\models\CmsContent */
/* @var $form yii\widgets\ActiveForm */
?>
<script type="text/javascript" src="/js/datepicker/WdatePicker.js"></script>
<div class="cms-content-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'type_id')->dropDownList(CmsContent::getCmsType()) ?>
    <?= $form->field($model, 'site_id')->dropDownList(BaseSite::getCmsSite()) ?>
  <?php
//Widget直接渲染Tag
echo \xj\ueditor\Ueditor::widget([
    'model' => $model,
    'attribute' => 'content',
//     'value' => 'content',
    'style' => 'width:100%;height:400px',
    'renderTag' => true,
    'readyEvent' => 'console.log("example2 ready")',
    'jsOptions' => [
        'serverUrl' => yii\helpers\Url::to(['/common/upload']),
        'autoHeightEnable' => true,
        'autoFloatEnable' => true
    ],
]);
?>

    <?= $form->field($model, 'create_time')->textInput(['value'=>time()]) ?>

    <?= $form->field($model, 'status')->dropDownList(['1'=>'可用','0'=>'不可用']) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
        <?= Html::a('返回列表', ['index'], ['class' => 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
